#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>

#include "quiz_lib.h"
#include "cmd_line_ui.h"

// Local function prototypes
void clean_string(char* text); 

int get_quiz_properties(struct quiz *local_quiz)
{
    //Parse Name
    strcpy((*local_quiz).name, "Method Not Implimented (pre-release)");

    return(0);
}

int validate_answer(char *correct_answer, char *supplied_answer)
{
    char supplied_answer_lower[MAX_ANSWER_SIZE];
    char correct_answer_lower[MAX_ANSWER_SIZE];
   
    strcpy(correct_answer_lower, correct_answer);
    strcpy(supplied_answer_lower, supplied_answer);

    clean_string(supplied_answer_lower);
    clean_string(correct_answer_lower);

   if (strcmp(supplied_answer_lower, correct_answer_lower) == 0)
        return(0);

    return(1);
}

void clean_string(char* text)
{
    int destination = 0;    
    int source;
    for (source = 0; source < strlen(text); source++) {
        if ((text[source] != '.') && (text[source] != '\n'))
        {
            text[destination] = tolower(text[source]);
            destination++;
        }
    }
    text[destination] = 0;
} 
